/**
 * 
 */
package com.seedwill.common.query.schema;

import java.util.Comparator;

import com.seedwill.common.util.SchemIdGen;

/**
 * 查询条件
 * 
 * @author kdyi  kdyi@hotmail.com
 *
 */
public class QueryCriteria extends QueryCriteriaSchema implements Comparator {

	/**
	 * 条件实例编号
	 */
	private String instanceId;
	
	/**
	 * 条件实例索引
	 */
	private int instanceIndex;

	/**
	 * 默认构造
	 */
	public QueryCriteria() {
		instanceIndex = index;
		instanceId = SchemIdGen.genSurfixId(schemaId);
	}

    /**
     * 属性值
     */
    private Object value;
	

	public Object getValue() {
		return value;
	}
	public void setValue(Object value) {
		this.value = value;
	}
	
	public int compare(Object reportCriteria1, Object reportCriteria2) {
		if(null != reportCriteria1 && null != reportCriteria2){
				return ((QueryCriteria)reportCriteria1).getInstanceIndex() - ((QueryCriteria)reportCriteria2).getInstanceIndex();
		}else{
			return 0;
		}
		
	}
	public String getInstanceId() {
		return instanceId;
	}
	public void setInstanceId(String instanceId) {
		this.instanceId = instanceId;
	}
	public int getInstanceIndex() {
		return instanceIndex;
	}
	public void setInstanceIndex(int instanceIndex) {
		this.instanceIndex = instanceIndex;
	}

}
